# -*- coding:utf-8 -*-

import mmap

m_fls_filetype = None
m_fls_filelength = None
m_fls_information = None
m_fls_Index_clear = None
m_fls_errorcode = None

class Flash:
    instance = None
    mm = None
    def __new__(cls, *args, **kwargs):
        if not cls.instance:
            cls.instance = super().__new__(cls)
            f = open('FLASH.DAT', 'r+b')
            cls.mm = mmap.mmap(f.fileno(), 0)
            f.close()
        return cls.instance

    def __del__(self):
        print(self.__class__.__name__, '__del__')

def FileCreat(filetype, filelength, information):
    Load_Para_FileCreat(filetype, filelength, information)
    if filelength == 0x000000:
        return 0x00, None, None
    m_fls_Index_clear = 0x00
    m_fls_errorcode = 0x01
    if m_fls_filetype >= 0x20:
        pass
    else:
        _00EB5F3E()

def Load_Para_FileCreat(filetype, filelength, information):
    m_fls_filetype = filetype
    m_fls_filelength = filelength
    m_fls_information = information


if __name__ == '__main__':
    print(FileCreat(0x13, 0x00001F, 'SysSetPWF'))